/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.lido.impl;

import de.sabram.upb.specs.lido.Attr;
import de.sabram.upb.specs.lido.ExpressionDep;
import de.sabram.upb.specs.lido.LidoPackage;
import de.sabram.upb.specs.lido.Loop;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Loop</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.lido.impl.LoopImpl#getExpressionDep <em>Expression Dep</em>}</li>
 *   <li>{@link de.sabram.upb.specs.lido.impl.LoopImpl#getAttr <em>Attr</em>}</li>
 *   <li>{@link de.sabram.upb.specs.lido.impl.LoopImpl#getExpressionDep_right <em>Expression Dep right</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LoopImpl extends PlainCompImpl implements Loop
{
  /**
   * The cached value of the '{@link #getExpressionDep() <em>Expression Dep</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getExpressionDep()
   * @generated
   * @ordered
   */
  protected ExpressionDep expressionDep;

  /**
   * The cached value of the '{@link #getAttr() <em>Attr</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAttr()
   * @generated
   * @ordered
   */
  protected Attr attr;

  /**
   * The cached value of the '{@link #getExpressionDep_right() <em>Expression Dep right</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getExpressionDep_right()
   * @generated
   * @ordered
   */
  protected ExpressionDep expressionDep_right;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected LoopImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return LidoPackage.Literals.LOOP;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExpressionDep getExpressionDep()
  {
    return expressionDep;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetExpressionDep(ExpressionDep newExpressionDep, NotificationChain msgs)
  {
    ExpressionDep oldExpressionDep = expressionDep;
    expressionDep = newExpressionDep;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.LOOP__EXPRESSION_DEP, oldExpressionDep, newExpressionDep);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setExpressionDep(ExpressionDep newExpressionDep)
  {
    if (newExpressionDep != expressionDep)
    {
      NotificationChain msgs = null;
      if (expressionDep != null)
        msgs = ((InternalEObject)expressionDep).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.LOOP__EXPRESSION_DEP, null, msgs);
      if (newExpressionDep != null)
        msgs = ((InternalEObject)newExpressionDep).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.LOOP__EXPRESSION_DEP, null, msgs);
      msgs = basicSetExpressionDep(newExpressionDep, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.LOOP__EXPRESSION_DEP, newExpressionDep, newExpressionDep));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Attr getAttr()
  {
    return attr;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAttr(Attr newAttr, NotificationChain msgs)
  {
    Attr oldAttr = attr;
    attr = newAttr;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.LOOP__ATTR, oldAttr, newAttr);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAttr(Attr newAttr)
  {
    if (newAttr != attr)
    {
      NotificationChain msgs = null;
      if (attr != null)
        msgs = ((InternalEObject)attr).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.LOOP__ATTR, null, msgs);
      if (newAttr != null)
        msgs = ((InternalEObject)newAttr).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.LOOP__ATTR, null, msgs);
      msgs = basicSetAttr(newAttr, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.LOOP__ATTR, newAttr, newAttr));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExpressionDep getExpressionDep_right()
  {
    return expressionDep_right;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetExpressionDep_right(ExpressionDep newExpressionDep_right, NotificationChain msgs)
  {
    ExpressionDep oldExpressionDep_right = expressionDep_right;
    expressionDep_right = newExpressionDep_right;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.LOOP__EXPRESSION_DEP_RIGHT, oldExpressionDep_right, newExpressionDep_right);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setExpressionDep_right(ExpressionDep newExpressionDep_right)
  {
    if (newExpressionDep_right != expressionDep_right)
    {
      NotificationChain msgs = null;
      if (expressionDep_right != null)
        msgs = ((InternalEObject)expressionDep_right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.LOOP__EXPRESSION_DEP_RIGHT, null, msgs);
      if (newExpressionDep_right != null)
        msgs = ((InternalEObject)newExpressionDep_right).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.LOOP__EXPRESSION_DEP_RIGHT, null, msgs);
      msgs = basicSetExpressionDep_right(newExpressionDep_right, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.LOOP__EXPRESSION_DEP_RIGHT, newExpressionDep_right, newExpressionDep_right));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case LidoPackage.LOOP__EXPRESSION_DEP:
        return basicSetExpressionDep(null, msgs);
      case LidoPackage.LOOP__ATTR:
        return basicSetAttr(null, msgs);
      case LidoPackage.LOOP__EXPRESSION_DEP_RIGHT:
        return basicSetExpressionDep_right(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case LidoPackage.LOOP__EXPRESSION_DEP:
        return getExpressionDep();
      case LidoPackage.LOOP__ATTR:
        return getAttr();
      case LidoPackage.LOOP__EXPRESSION_DEP_RIGHT:
        return getExpressionDep_right();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case LidoPackage.LOOP__EXPRESSION_DEP:
        setExpressionDep((ExpressionDep)newValue);
        return;
      case LidoPackage.LOOP__ATTR:
        setAttr((Attr)newValue);
        return;
      case LidoPackage.LOOP__EXPRESSION_DEP_RIGHT:
        setExpressionDep_right((ExpressionDep)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.LOOP__EXPRESSION_DEP:
        setExpressionDep((ExpressionDep)null);
        return;
      case LidoPackage.LOOP__ATTR:
        setAttr((Attr)null);
        return;
      case LidoPackage.LOOP__EXPRESSION_DEP_RIGHT:
        setExpressionDep_right((ExpressionDep)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.LOOP__EXPRESSION_DEP:
        return expressionDep != null;
      case LidoPackage.LOOP__ATTR:
        return attr != null;
      case LidoPackage.LOOP__EXPRESSION_DEP_RIGHT:
        return expressionDep_right != null;
    }
    return super.eIsSet(featureID);
  }

} //LoopImpl
